A17 - Dungeon 2
提出
code: python
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
# 0 1 2 3 4
# 2---4---1---3
# 5---3---3
select = []
for i in range(2, n):
select.append("a")
else:
select.append("b")
print(dp)
print(select)
解答
code: python
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
# 0 1 2 3 4
# 2---4---1---3
# 5---3---3
for i in range(2, n):
# print(a) 2 4 1 3
# print(b) 5 3 3
# print(dp)
# 答えの復元
# 変数 p は現在位置(ゴールから進んでいく)
# p: 4 → 3 → 1 → 0
ans = []
p = n-1
while True:
ans.append(p)
if p == 0:
break
# どこから部屋 p に向かうのが最適かを求める
p = p - 1
p = p - 2
ans.reverse()
print(len(ans))
print(" ".join(ans2))